package com.katus.tileserver.controller;

import com.katus.tileserver.bean.Result;
import com.katus.tileserver.dao.ModelDao;
import com.katus.tileserver.entity.Model;
import com.katus.tileserver.entity.dto.ModelDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author jiarui
 * @version 1.0, 2022-11-21
 */

@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/model")
public class ModelController {

    @Autowired
    ModelDao modelDao;

    @RequestMapping(value = "/estimate",method = RequestMethod.POST)
    @ResponseBody
    public Result<Object> estimate(@RequestBody ModelDTO modelDTO){
        Model layer = modelDao.getLayer(modelDTO);
        if (layer==null){
            return Result.success().setMessage("不存在此数据");
        }
        return Result.success().setBody(layer).setMessage("查询成功");
    }
}
